package com.cgc999.host.fragment;

import android.content.ComponentName;
import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.cgc999.host.R;
import com.cgc999.host.base.BaseLazyFragment;

public class IndexFragment extends BaseLazyFragment {
    Button btnJump;
    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
//        return super.onCreateView(inflater, container, savedInstanceState);
        View view = inflater.inflate(R.layout.fragment_index, container, false);
        btnJump=view.findViewById(R.id.btn_jump);
        btnJump.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                startAccessory();
            }
        });
        return view;
    }

    @Override
    public void reFreshData() {

    }



    public void startAccessory() {
        ComponentName componentName = new ComponentName(
                "com.cgc999.accessory",
                "com.cgc999.accessory.MainActivity");
        Intent intent = new Intent();
        Bundle bundle = new Bundle();
        String resurl = "startHostSuccess ";
        bundle.putString("resUrl", resurl);
        String[] picurllist = {"百度搜索", "阿里云", "腾讯邮箱"};
        bundle.putSerializable("picUrlList", picurllist);
        intent.putExtras(bundle);
        intent.setComponent(componentName);
        startActivity(intent);
//        注:
//        com.xiaohua.player.activity:包路径
//        PlayerActivity:Activity类
//        resUrl :String类型
//        picUrlList:数组，也可以是对象

    }

}
